//package one.stand.service.impl;
//
//import com.alibaba.fastjson.JSON;
//import com.github.pagehelper.PageHelper;
//import com.github.pagehelper.PageInfo;
//import one.stand.model.ResultModel;
//import one.stand.model.essay.EssayTypeModel;
//import one.stand.service.BaseService;
//import one.stand.service.CustomerEssayService;
//import one.stand.util.DateUtil;
//import org.springframework.beans.BeanUtils;
//import org.springframework.stereotype.Service;
//import org.springframework.transaction.annotation.Transactional;
//
//import java.util.ArrayList;
//import java.util.List;
//import java.util.Optional;
//
///**
// * 获客文章业务
// * @author luoyang
// * @date 2020/5/6 19:20
// */
//@Service
//@Transactional
//public class CustomerEssayServiceImpl  extends BaseService implements CustomerEssayService {
////    @Override
////    public ResultModel<Boolean> insert(CustomerEssayRequest request) {
////        CustomerEssayModel model = new CustomerEssayModel();
////        BeanUtils.copyProperties(request,model);
////        model.setCompanyId(request.getCId());
////        if( this.customerEssayMapper.insert(model) > 0){
////            return ResultModel.success();
////        }
////        return ResultModel.fail();
////    }
////
////    @Override
////    public ResultModel<Boolean> update(CustomerEssayRequest request) {
////        CustomerEssayModel oldModel = this.customerEssayMapper.queryById(request.getCusEssayId());
////        if(oldModel == null){
////            return ResultModel.fail("未找到文章");
////        }
////
////        BeanUtils.copyProperties(request,oldModel,"id","deleted","created_time");
////        if(this.customerEssayMapper.update(oldModel) > 0){
////            return ResultModel.success();
////        }
////        return ResultModel.fail();
////    }
////
////    @Override
////    public ResultModel<CustomerEssayResponse> queryById(Long cusEssayId) {
////        if(cusEssayId == null){
////            return ResultModel.fail("未找到文章");
////        }
////        CustomerEssayModel  oldModel = this.customerEssayMapper.queryById(cusEssayId);
////        if(oldModel == null){
////            return ResultModel.fail("未找到文章");
////        }
////
////        CustomerEssayResponse response = new CustomerEssayResponse();
////        BeanUtils.copyProperties(oldModel,response);
////
////        return ResultModel.success(response);
////    }
////
////    @Override
////    public ResultModel<PageInfo<CustomerEssayResponse>> queryPage(CustomerEssayRequest request) {
////        CustomerEssayModel model = new CustomerEssayModel();
////        BeanUtils.copyProperties(request, model);
////        model.setCompanyId(request.getCId());
////        PageHelper.startPage(request.getPageNum(), request.getPageSize());
////        log.info("查询文章分类列表参数: {}", JSON.toJSONString(model));
////
////        List<CustomerEssayModel> list = customerEssayMapper.queryAll(model);
////        List<CustomerEssayResponse> customerEssayResponses = new ArrayList<>(0);
////        list.forEach(essayTypeModel -> {
////            {
////                CustomerEssayResponse response = new CustomerEssayResponse();
////                BeanUtils.copyProperties(essayTypeModel, response);
////                customerEssayResponses.add(response);
////            }
////        });
////
////        PageInfo<CustomerEssayResponse> pageInfo = new PageInfo(customerEssayResponses);
////        return ResultModel.success(pageInfo);
////    }
////
////    @Override
////    public ResultModel<Boolean> pubState(CustomerEssayRequest request) {
////        CustomerEssayModel oldModel = this.customerEssayMapper.queryById(request.getCusEssayId());
////        oldModel.setPubState(request.getPubState());
////        //发布更新时间
////        if(request.getPubState() == 1){
////            oldModel.setPubTime(DateUtil.now());
////        }
////        if(this.customerEssayMapper.update(oldModel) > 0 ){
////            return ResultModel.success();
////        }
////        return ResultModel.fail();
////    }
//}
